package cn.edu.gzgs.mapper;

import cn.edu.gzgs.entity.UserTitle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户-职称关联Mapper
 * @author Zyf
 */
@Mapper
public interface UserTitleMapper extends BaseMapper<UserTitle> {

    /**
     * 批量插入用户职称关联记录
     *
     * @param userTitleList 用户职称关联列表
     */
    @Insert("""
            <script>
                INSERT INTO user_title (user_id, title_id) VALUES
                <foreach collection="userTitleList" item="item" separator=",">
                    (#{item.userId}, #{item.titleId})
                </foreach>
            </script>
            """)
    void batchInsert(@Param("userTitleList") List<UserTitle> userTitleList);
} 